Conversation
…o list Using Sou (aws#5518)
aviruthen
commented
Mar 23, 2026
Owner
Author
There was a problem hiding this comment.
Can you add a comment right above your source code change explaining why you made that change?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix TypeError when Pipeline.upsert() with SourceCode without requirements
Fixes aws#5518
Problem
When using
SourceCodewithout settingrequirements(which defaults toNone) in aTrainingStepwithin a Pipeline, callingpipeline.upsert()could raise:This occurs in
get_processing_code_hash()where thedependenciesparameter can beNonebut is used in list concatenation like[source_dir] + dependencies.Fix
Added a defensive
dependencies = dependencies or []at the start ofget_processing_code_hash()to ensureNonedependencies are converted to an empty list before any list concatenation operations.Testing
Added test cases for:
get_processing_code_hashwithNonedependencies (with and withoutsource_dir)get_training_code_hashwithNonedependencies (withsource_dirand withentry_pointonly)get_code_hashforTrainingStepwhenSourceCode.requirementsisNoneRelated Issue
Fixes aws#5518
Changes Made
The bug occurs when
SourceCode.requirementsis not set (defaults toNone) and aTrainingStepis used in a Pipeline. Inget_code_hash(),source_code.requirements(which isNone) is passed asdependenciestoget_training_code_hash(). While the currentget_training_code_hash()hasif dependencies:guards, theget_processing_code_hash()function does NOT guard againstNonedependencies and directly concatenates[source_dir] + dependencies, which would fail withTypeError: can only concatenate list (not 'NoneType') to list. The fix is to defaultdependenciesto an empty list at the start ofget_processing_code_hash(), and add a similar defensive default inget_code_hash()when extractingrequirementsfromSourceCodefor the training step path.AI-Generated PR
This PR was automatically generated by the PySDK Issue Agent.
Merge Checklist
prefix: descriptionformat